package com.xixi.core.rpc.fault.tolerant;

import com.xixi.core.rpc.spi.SpiLoader;

/**
 * @author: zxh
 * @date: 2024/8/27 16:50
 * @description: 容错策略工厂
 */
public class TolerantStrategyFactory {

	static {
		SpiLoader.load(TolerantStrategy.class);
	}

	private static final TolerantStrategy DEFAULT_RETRY_STRATEGY = new FailFastTolerantStrategy();

	/**
	 * 获取实例
	 * @author zxh
	 * @param key 容错机制key
	 * @return 返回容错机制实例
	 */
	public static TolerantStrategy getInstance(String key) {
		return SpiLoader.getInstance(TolerantStrategy.class, key);
	}
}
